#ifndef _EPOLLE_H_
#define _EPOLLE_H_

#include "sys/epoll.h"
#include "unistd.h"
#include "memory"
#include "task.h"

namespace easyWebServer
{

class Task;

class Epoll
{
public:
    Epoll();
    ~Epoll();

    void setEpollEventSize(int size);
    void createEpollfd();
    void addEvent(int fd, uint32_t event);
    void addEvent(int fd, uint32_t event, unique_ptr<Task> & task);
    void delEvent(int fd);
    int epollWait(int time);
    struct epoll_event * getEventList();
    

private:
    int m_fd = -1;
    struct epoll_event * m_event = nullptr;
    int m_size = -1;

};

#define EPOLLINSTANCE Singleton<Epoll>::getInstance()

}

#endif